package cuShapes;

import java.awt.*;
import javax.xml.bind.annotation.*;
import java.awt.geom.Line2D;

/***********************************
 * This class manages two points, and will draw
 * a line between them. 
 * 
 * @author Dan Ward, Chris Walling, Jonathan Dickson 
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="xmlstraightline")
public class StraightLine extends PQLine{
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -1511361452157912351L;

	public StraightLine(){}
	
	public StraightLine (Point start, Point end, Color c) {
		color = new Color(c.getRGB());
		p1 = start;
		p2 = end;
	}
	
	public StraightLine (StraightLine x){
		color = new Color(x.getColor().getRGB());
		p1 = new Point(x.getStart().x, x.getStart().y);
		p2 = new Point(x.getEnd().x, x.getEnd().y);
	}
	
	public void setStart(Point start) {
		p1 = start;
	}
	
	public void setEnd(Point end) {
		p2 = end;
	}

	public void drawLine(Graphics2D g2) {
		g2.setColor(color);
		g2.draw(new Line2D.Double(p1, p2));
	}

	@Override
	public Point getEnd() {
		return p2;
	}

	@Override
	public Point getStart() {
		return p1;
	}
}
